{% extends 'base.html' %}

{% block title %}
    <title>index</title>
{% endblock %}

{% block con %}
    <h3>Index</h3>
    <p>{{ name }}</p>
    <p>{{ i }}</p>
    <p>{{ l }}</p>
    <p>{{ info }}</p>
    <p>{{ b }}</p>
    <p>{{ alex }}</p>
    <p>{{ egon }}</p>
    <p>{{ person_list }}</p>
    <h4>深度查询</h4>
    <p>{{ l.1 }}</p>
    <p>{{ info.name }}</p>
    <p>{{ alex.name }}</p>
    <p>{{ alex.age }}</p>
    <p>{{ person_list.1.age }}</p>
    <h4>过滤器</h4>
    <p>{{ now|date:'Y-m-d' }}</p>
    <p>{{ empty_list|default:'列表为空' }}</p>
    <p>{{ file_size|filesizeformat }}</p>
    <p>{{ text|truncatechars:8 }}</p>
    <p>{{ text|truncatewords:5 }}</p>
    <p>{{ link|safe }}</p>
    <p>{{ l.0|add:100 }}</p>
    <p>{{ info.name|upper }}</p>
    <h4>for标签</h4>
    {% for i in l %}
        <p>{{ i }}</p>
    {% endfor %}

    {% for person in person_list %}
        <p>{{ forloop.counter }} {{ person.name }} {{ person.age }}</p>
    {% endfor %}

    {% for person in empty_list %}
        <p>{{ forloop.counter }} {{ person.name }} {{ person.age }}</p>
    {% empty %}
        <p>列表为空</p>
    {% endfor %}
    <hr>
    {% if user %}
        <p>
            <a href="">Hi, {{ user }}!</a>
        </p>
    {% else %}
        <p>
            <a href="">登录</a>
            <a href="">注册</a>
        </p>
    {% endif %}

    <hr>
    {% with person_list.1.name as n %}
        {{ n }}
    {% endwith %}
    <hr>
    <h4>自定义过滤器和标签</h4>
    {% load my_tag_filter %}
    <p>{{ i|multi_filter:20 }}</p>
    <p>{% multi_tag 7 9 6 %}</p>

    {% if i|multi_filter:10 >= 100 %}
        <p>100</p>
    {% else %}
        <p>{{ i }}</p>
    {% endif %}
{% endblock %}